/*
 * @Author: @yzcheng
 * @Date: 2021-04-17 18:14:09
 * @Version: 1.0
 * @LastEditors: @yzcheng
 * @Description:
 * @LastEditTime: 2021-06-17 18:05:45
 */
import request from '@/utils/request'
import { CHECC_API_BASE_DATA } from '@/constants/proxy'
//锁定解锁
export const lockParagraphRequest = (id: string) =>
  request({
    url: CHECC_API_BASE_DATA + `/bdSection/bridgeLock/${id}?dataLock=0`,
    method: 'post',
  })

/**
 * 请求路段分页
 *
 * @export
 * @param {*} params
 * @return {*}  {Promise<any>}
 */
export function requestParagraphList(params: any, data: any): Promise<any> {
  return request({
    url: CHECC_API_BASE_DATA + `/bdSection/page`,
    method: 'post',
    params,
    data,
  })
}
//添加路段信息
export function changeParagraphData({ method, data }: any): Promise<any> {
  return request({
    url: CHECC_API_BASE_DATA + `/bdSection`,
    method,
    data,
  })
}

//根据id查询段落信息
export function requestParagraph(id: any): Promise<any> {
  return request({
    url: CHECC_API_BASE_DATA + `/bdSection/${id}`,
    method: 'get',
  })
}
//删除路段信息
export function delParagraphData(data: any): Promise<any> {
  return request({
    url: CHECC_API_BASE_DATA + `/bdSection/remByIds`,
    method: 'delete',
    data,
  })
}
export function getbdroute({ data, params }: any) {
  return request({
    url: CHECC_API_BASE_DATA + '/bd-fixed-section/page',
    method: 'post',
    data,
    params,
  })
}
//子表
/**
 * 获取段落子表养护工区详细信息
 *
 * @export
 * @param {*} id
 * @return {*}
 */
export function getMaintenance(data: any, params: any = { pageNum: 1, pageSize: 10 }) {
  return request({
    url: CHECC_API_BASE_DATA + `/bd-road-maintaince-unit/page`,
    method: 'post',
    data,
    params,
  })
}
/**
 * 改变段落子表养护工区详细信息
 *
 * @export
 * @param {*} id
 * @return {*}
 */
export function changeMaintenance(method: any, data: any) {
  return request({
    url: CHECC_API_BASE_DATA + `/bd-road-maintaince-unit`,
    method,
    data,
  })
}
/**
 * 获取行政区域子表单挑详细信息
 *
 * @export
 * @param {*} id
 * @return {*}
 */
export function getAdministrative(data: any, params: any = { pageNum: 1, pageSize: 10 }) {
  return request({
    url: CHECC_API_BASE_DATA + `/bd-section-region/page`,
    method: 'post',
    data,
    params,
  })
}
/**
 * 改变行政区域子表单挑详细信息
 *
 * @export
 * @param {*} id
 * @return {*}
 */
export function changeAdministrative(method: any, data: any) {
  return request({
    url: CHECC_API_BASE_DATA + `/bd-section-region`,
    method,
    data,
  })
}
/**
 * 获取路面宽度子表单挑详细信息
 *
 * @export
 * @param {*} id
 * @return {*}
 */
export function getRoadWidth(data: any, params: any = { pageNum: 1, pageSize: 10 }) {
  return request({
    url: CHECC_API_BASE_DATA + `/bd-road-width/page`,
    method: 'post',
    data,
    params,
  })
}
/**
 * 改变路面宽度子表单挑详细信息
 *
 * @export
 * @param {*} id
 * @return {*}
 */
export function changeRoadWidth(method: any, data: any) {
  return request({
    url: CHECC_API_BASE_DATA + `/bd-road-width`,
    method,
    data,
  })
}
/**
 * 获取路面类型子表单挑详细信息
 *
 * @export
 * @param {*} id
 * @return {*}
 */
export function getRoadType(data: any) {
  return request({
    url: CHECC_API_BASE_DATA + `/bd-road-structure/list`,
    method: 'post',
    data,
  })
}
/**
 * 获取车道数量子表单挑详细信息
 *
 * @export
 * @param {*} id
 * @return {*}
 */
export function getLaneNumber(data: any, params: any = { pageNum: 1, pageSize: 10 }) {
  return request({
    url: CHECC_API_BASE_DATA + `/bd-road-lane/page`,
    method: 'post',
    data,
    params,
  })
}
/**
 * 改变车道数量子表单挑详细信息
 *
 * @export
 * @param {*} id
 * @return {*}
 */
export function changeLaneNumber(method: any, data: any) {
  return request({
    url: CHECC_API_BASE_DATA + `/bd-road-lane`,
    method,
    data,
  })
}
/**
 * 获取通车时间子表单挑详细信息
 *
 * @export
 * @param {*} id
 * @return {*}
 */
export function getTrafficTime(data: any, params: any = { pageNum: 1, pageSize: 10 }) {
  return request({
    url: CHECC_API_BASE_DATA + `/bd-section-open-month/page`,
    method: 'post',
    data,
    params,
  })
}
/**
 * 改变通车时间子表单挑详细信息
 *
 * @export
 * @param {*} id
 * @return {*}
 */
export function changeTrafficTime(method: any, data: any) {
  return request({
    url: CHECC_API_BASE_DATA + `/bd-section-open-month`,
    method,
    data,
  })
}
/**
 * 获取段落子表桩号不连续详细信息
 *
 * @export
 * @param {*} id
 * @return {*}
 */
 export function getStation(data: any, params: any = { pageNum: 1, pageSize: 10 }) {
  return request({
    url: CHECC_API_BASE_DATA + `/bd-section-station-discontinuity/page`,
    method: 'post',
    data,
    params,
  })
}

/**
 * 改变段落子表桩号不连续详细信息
 *
 * @export
 * @param {*} id
 * @return {*}
 */
 export function changeStation(method: any, data: any) {
  return request({
    url: CHECC_API_BASE_DATA + `/bd-section-station-discontinuity`,
    method,
    data,
  })
}